package com.shuma.auth.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shuma.auth.entity.RestBean;
import com.shuma.auth.mapper.UserProductMapper;
import com.shuma.auth.model.dto.ProxyUserInfoDto;
import com.shuma.auth.model.dto.QueryProxyUserParams;
import com.shuma.auth.model.po.UserProduct;
import com.shuma.auth.service.UserProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 管理人（运营或代理人）和商品的关联 服务实现类
 * </p>
 *
 * @author lele
 */
@Slf4j
@Service
public class UserProductServiceImpl extends ServiceImpl<UserProductMapper, UserProduct> implements UserProductService {
    @Resource
    UserProductMapper userProductMapper;

    @Override
    public List<Long> selectProductIdsByUsername(String caretaker) {
        caretaker="%"+caretaker+"%";
        List<Long> productIds = userProductMapper.selectProductIdsByUsername(caretaker);
        return productIds;
    }

    @Override
    public RestBean<List<ProxyUserInfoDto>> selectProxyUserByUsername(QueryProxyUserParams queryProxyUserParams) {
        List<ProxyUserInfoDto> proxyUserInfoDtos = userProductMapper.selectProxyUserByUsername(queryProxyUserParams);
        return RestBean.success(proxyUserInfoDtos);
    }
}
